package com.share.bean.sysmgr.privilege;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.share.bean.oa.org.Employee;


/**
 * <p>Title：权限角色</p>
 * <p>Description：</p>
 * @Author 杨浩泉
 * @Date 2010-2-28
 */
@Entity
@Table(name="share_privilegeRole")
public class PrivilegeRole implements Serializable {
	
	private static final long serialVersionUID = 1L;

	private int roleId ;
	
	private String roleName ;
	
	private String roleDesc ;

	private Set<PrivilegeResource> resource ;

	private Set<Employee> employee ;

	@ManyToMany(mappedBy="role",cascade=CascadeType.REMOVE)
	public Set<Employee> getEmployee() {
		return employee;
	}

	@ManyToMany(fetch=FetchType.EAGER)
	@JoinTable(name="share_privilege_role_res",
				joinColumns={@JoinColumn(name="role_id")},
				inverseJoinColumns={@JoinColumn(name="res_id")})
	public Set<PrivilegeResource> getResource() {
		return resource;
	}

	public String getRoleDesc() {
		return roleDesc;
	}

	@Id
	@GeneratedValue
	public int getRoleId() {
		return roleId;
	}
	
	public String getRoleName() {
		return roleName;
	}
	
	public void setEmployee(Set<Employee> employee) {
		this.employee = employee;
	}

	public void setResource(Set<PrivilegeResource> resource) {
		this.resource = resource;
	}

	public void setRoleDesc(String roleDesc) {
		this.roleDesc = roleDesc;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

}
